#include "PetCreator.hpp"
#include "Dog.hpp"
#include "Cat.hpp"

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

inline char toLower(char c)
{
    return tolower(c);
}

Pet *PetCreator::createPet(string pet_type)
{
    transform(pet_type.begin(), pet_type.end(), pet_type.begin(), toLower);
    if (pet_type == "cat")
    {
        return new Cat;
    }
    else if (pet_type == "dog")
    {
        return new Dog;
    }
    else
    {
        return nullptr;
    }
}
